var ToastLayer = cc.Layer.extend({
	_txt:"金币不足!",
	toastText:null,
	ctor:function () {
		this._super();
		
	},
	tictoc: function(){
		this.removeFromParent(true);
		//this.unschedule(this.tictoc);
	},
	setTxt: function(txt){
		this._txt = txt;
		
		this.toastText = new ccui.Text(this._txt, "res/DFWaWaW5-GB.ttc",  50, cc.size(350, 200),
					cc.TEXT_ALIGNMENT_CENTER, cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
		this.toastText.x = this.width / 2;
		this.toastText.y = this.height * 3 / 4;
		this.addChild(this.toastText);
		
		var bigger = cc.scaleBy(0.1, 1.5, 1.5);
		var smaller = cc.scaleBy(0.1, 2/3, 2/3);
		var action = cc.sequence(bigger, smaller);
		this.toastText.runAction(action);
		
		this.scheduleOnce(this.tictoc, 0.5);
	},
	showCoinNotEnough: function(){
		this.toastText = new ccui.Text(this._txt, "res/DFWaWaW5-GB.ttc", 50, cc.size(350, 200),
				cc.TEXT_ALIGNMENT_CENTER, cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
		this.toastText.x = this.width / 2;
		this.toastText.y = this.height / 10;
		this.addChild(this.toastText);

		var bigger = cc.scaleBy(0.1, 1.5, 1.5);
		var smaller = cc.scaleBy(0.1, 2/3, 2/3);
		var action = cc.sequence(bigger, smaller);
		this.toastText.runAction(action);
		
		this.scheduleOnce(this.tictoc, 1.5);
	},
	addShare: function(){
		this.toastText = new ccui.Text("分享成功，获得20金币！！！", "res/DFWaWaW5-GB.ttc", 50, cc.size(350, 200),
				cc.TEXT_ALIGNMENT_CENTER, cc.VERTICAL_TEXT_ALIGNMENT_CENTER);
		this.toastText.x = this.width / 2;
		this.toastText.y = this.height / 10;
		this.addChild(this.toastText);

	},
	showShare: function() {
		var bigger = cc.scaleBy(0.1, 1.5, 1.5);
		var smaller = cc.scaleBy(0.1, 2/3, 2/3);
		var action = cc.sequence(bigger, smaller);
		this.toastText.runAction(action);
		
		this.scheduleOnce(this.hide, 1.5);
	},
	hide: function() {
		
		this.setVisible(false);
	}

});